import { report } from '../utils/report.js'
import { onBeforeunload, getPagePath } from '../utils/common.js'
import getUUID from '../utils/getUUID.js'

/**
 * 页面停留时长
 * */
export default function pageAccessDuration() {
    setTimeout(function (){
        const data = {
            type: 'behavior',
            subType: 'page-access-duration',
            startTime: performance.now(),
            pagePath: getPagePath(),
            uuid: getUUID(),
        }
        report(data, true)
    },5000)
    // onBeforeunload(() => {
    //     const data = {
    //         type: 'behavior',
    //         subType: 'page-access-duration',
    //         startTime: performance.now(),
    //         pagePath: getPagePath(),
    //         uuid: getUUID(),
    //     }
    //     report(data, true)
    // })
}
